package day12_coll.demo03_comparable;

public class Student implements Comparable<Student> {
    @Override
    public int compareTo(Student o) {
//        int age=this.age//插入数据
//        int age1=o.getAge()//已插入的数据
//        System.out.println(age);
//        System.out.println(age1);
        int sum=o.getAge()-this.age;
        return sum;
    }
    private String name;
    private int age;
    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public int getAge() {
        return age;
    }

    public void setAge(int age) {
        this.age = age;
    }

    public Student(String name, int age) {
        this.name = name;
        this.age = age;
    }

    public Student() {
    }


}
